package de.logicline.cvss.ui.view.table;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

import de.logicline.cvss.vo.CVSSearchEntry;

public class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
	
	private DateFormat df = new SimpleDateFormat("dd.MM.yy HH:mm");
	
	public Image getColumnImage(Object element, int columnIndex) {
		return null;
	}
	public String getColumnText(Object element, int columnIndex) {
		CVSSearchEntry entry = (CVSSearchEntry) element;
		switch (columnIndex) {
			case 0 :
				return entry.getAuthor();
			case 1 :
				return df.format(entry.getDate());
			case 2 :
				return entry.getComment();
			case 3 :
				return entry.getProject().getName();
		}
		return "";
	}
	public void addListener(ILabelProviderListener listener) {
	}
	public void dispose() {
	}
	public boolean isLabelProperty(Object element, String property) {
		return true;
	}
	public void removeListener(ILabelProviderListener listener) {
	}
	}